home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir36
/
tsbat46.zip
/
ARC2ZIP.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-08-30
|
4KB
|
168 lines
echo off
rem
rem Do not distribute ARC2ZIP.BAT separately from the rest of the package
rem
rem If you get an "Out of environment space" message, increase your
rem environment space by using shell configuration in config.sys:
rem Example: shell=c:\bin\command.com /e:1024 /p
echo.
echo ┌───────────────────────────────────────────────────────────────┐
echo │ Convert and datestamp a single .arc to .zip file with comment │
echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sun 30-Aug-1992 │
echo └───────────────────────────────────────────────────────────────┘
if not "%1"=="" goto _continue
echo.
echo Usage: ARC2ZIP PackageName [/r(eplace the old .arc with the new .zip)]
echo Use no drive name! No extension!
echo ┌───────────────┐
echo │ NO WILDCARDS! │
echo └───────────────┘
echo.
echo When using for the first time:
echo 1) Make pkunpak.exe and pkzip.exe available
echo 2) Make a new directory e:\arczip\zip for converted files
echo 3) Edit your own zip-file comment to e:\arczip\comment.txt (not provided)
echo 4) Carefully adjust the paths in the batch, if necessary
echo.
echo Usually:
echo Place the .arc file in directory e:\arczip\arc
echo And run normally
echo.
echo.
goto _out
:_continue
rem Do the necessary programs, the comment file, and zip directory exist
if not exist c:\tools\pkzip.exe goto _err1
if not exist c:\tools\pkunpak.exe goto _err2
if not exist e:\arczip\comment.txt goto _err3
if not exist e:\arczip\zip\nul goto _err8
if not exist c:\tools\scan.exe goto _err11
rem Check that wilrcards have not been used
for %%f in (%1) do if "%1"=="%%f" goto :_testext
echo No wildcards allowed in the file name %1
goto _out
rem Check that no extension was used
:_testext
set _exten=%1
:_nextchar
set _prev=%_exten%
for %%f in (/%_exten%) do set _exten=%%f
if ".%_exten%"=="%_prev%" goto _extfound
if not "%_exten%"=="%_prev%" goto _nextchar
goto _noext
:_extfound
echo No extension allowed in the file name %1
goto _out
:_noext
set _exten=
rem Build the names for source .arc and target .zip files
set _filea=e:\arczip\arc\%1.arc
set _filez=e:\arczip\zip\%1.zip
if not exist %_filea% goto _err4
if exist %_filez% goto _err5
if not exist e:\arczip\tmp$$$\nul md e:\arczip\tmp$$$
if exist e:\arczip\tmp$$$\*.* goto _err9
rem Test archive integrity
pkunpak -t %_filea%
if errorlevel==1 goto _err10
rem Unpack and check for viruses
pkunpak %_filea% e:\arczip\tmp$$$
c:\tools\scan /m /nomem /x e:\arczip\tmp$$$
if errorlevel==1 goto _err12
rem Convert, use the date of the latest file, not the current date
pkzip -a %_filez% e:\arczip\comment.txt
pkzip -z %_filez% < e:\arczip\comment.txt
pkzip -d %_filez% comment.txt
pkzip -br:\ -u -m -o %_filez% e:\arczip\tmp$$$\*.*
pkzip -v %_filez%
dir %_filez%
rd e:\arczip\tmp$$$
rem State of the /r switch for replacing the old .arc file
if "%2"=="/r" goto _replace
if "%2"=="/R" goto _replace
goto _out
rem Replace the old .arc file with the new .zip file
:_replace
echo.
echo To delete %_filea% press any key
echo To cancel, use the Break key now
pause >nul
if not exist %_filez% goto _err6
if exist %_filea% del %_filea%
if exist %_filea% goto _err7
echo.
echo File %_filea% deleted
goto _out
:_err1
Echo File c:\tools\pkzip.exe not found
goto _out
:_err2
Echo File c:\tools\pkunpak.exe not found
goto _out
:_err3
Echo File e:\arczip\comment.txt not found
goto _out
:_err4
Echo File %_filea% not found
echo.
echo Usage: ARC2ZIP PackageName [/r(eplace the old .arc with the new .zip)]
echo Use no drive name! No extension!
echo ┌───────────────┐
echo │ NO WILDCARDS! │
echo └───────────────┘
goto _out
:_err5
Echo File %_filez% already exists
goto _out
:_err6
Echo ARC2ZIP aborted: File %_filez% not found
goto _out
:_err7
Echo ARC2ZIP aborted: Disk or file %_filea% is readonly
goto _out
:_err8
Echo Error: Directory e:\arczip\zip does not exist
goto _out
:_err9
Echo Error: Directory e:\arczip\tmp$$$ is not empty
goto _out
:_err10
Echo ARC2ZIP aborted: Error in %_filea%
goto _out
:_err11
Echo File c:\box\tools\scan.exe not found
goto _out
:_err12
Echo ARC2ZIP aborted: Scan reports problems in c:\arczip\tmp$$$
goto _out
:_out
set _filea=
set _filez=
set _exten=
echo on